home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac 1 / Ian and Stuart's One (Australia).iso / Australasian Legends / Commercial / Rainbow Hill / MacDOS™ 2.0.0 / batches / deldir.bat < prev    next >
DOS Batch File  |  1994-07-04  |  971b  |  40 lines

  1. @echo off
  2. !  deldir.bat    Batch file to delete a folder with all its contents
  3. !
  4. !  deldir name
  5. !
  6. !  where 'name' is the folder to be deleted. It can be preceded by a path and a
  7. !  volume ID.
  8. !
  9. !  deldir.bat calls uniqueTempName and deldir1
  10. !
  11. !  Copyright © 1994 by Rainbow Hill Pty Ltd. All rights reserved.
  12. !
  13.  
  14.     ! ensure that the first parameter is there and that the third one is not
  15.     set doserr=13
  16.     if not "%3 " == " " goto DONE_LBL
  17.     if "%1 " == " " goto DONE_LBL
  18.  
  19.     ! ensure that the requested folder is there
  20.     set doserr=27
  21.     if not existdir "%1" goto DONE_LBL
  22.  
  23.     ! save the current directory: we will have to attach back in a couple of places
  24.     set deldir_back=%where%
  25.  
  26.     onerror DONE_LBL
  27.  
  28.     ! recursively delete the content of the folder
  29.     set doserr=0
  30.     call deldir1 "%1"
  31.  
  32.     ! attach back to the original current directory, which was changed by deldir1
  33.     cd "%deldir_back%"
  34.  
  35. :DONE_LBL
  36.     if not %doserr% == 0 show %doserr%
  37.     !
  38.     ! remove the global variables
  39.     set deldir_back=
  40.